<!DOCTYPE html><html lang="zh-CN" data-theme="light"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"><title>vuex | lhx个人博客</title><meta name="keywords" content="前端基础CSS、Js、Vue、React、移动端、小程序、网络"><meta name="author" content="李汉鑫"><meta name="copyright" content="李汉鑫"><meta name="format-detection" content="telephone=no"><meta name="theme-color" content="#ffffff"><meta name="description" content="1. vuex是什么一个vue插件库 作用: 对vue应用中组件的状态进行集中式的管理  2. vuex的核心概念1). statevuex管理的状态对象 它应该是唯一的 const state &#x3D; &amp;#123;   xxx: initValue &amp;#125;  2). mutations包含多个直接更新state的方法(回调函数)的对象 谁来触发: action中的commit(&#39;mut">
<meta property="og:type" content="article">
<meta property="og:title" content="vuex">
<meta property="og:url" content="http://example.com/Vue/vuex/index.html">
<meta property="og:site_name" content="lhx个人博客">
<meta property="og:description" content="1. vuex是什么一个vue插件库 作用: 对vue应用中组件的状态进行集中式的管理  2. vuex的核心概念1). statevuex管理的状态对象 它应该是唯一的 const state &#x3D; &amp;#123;   xxx: initValue &amp;#125;  2). mutations包含多个直接更新state的方法(回调函数)的对象 谁来触发: action中的commit(&#39;mut">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/img/default.jpg">
<meta property="article:published_time" content="2018-04-30T15:01:31.000Z">
<meta property="article:modified_time" content="2021-09-01T02:26:37.770Z">
<meta property="article:author" content="李汉鑫">
<meta property="article:tag" content="前端基础CSS、Js、Vue、React、移动端、小程序、网络">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/img/default.jpg"><link rel="shortcut icon" href="https://img2.baidu.com/it/u=1328275982,1207856622&fm=26&fmt=auto&gp=0.jpg"><link rel="canonical" href="http://example.com/Vue/vuex/"><link rel="preconnect" href="//cdn.jsdelivr.net"/><link rel="preconnect" href="//busuanzi.ibruce.info"/><link rel="stylesheet" href="/css/index.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free/css/all.min.css" media="print" onload="this.media='all'"><script>const GLOBAL_CONFIG = { 
  root: '/',
  algolia: undefined,
  localSearch: undefined,
  translate: undefined,
  noticeOutdate: undefined,
  highlight: {"plugin":"highlighjs","highlightCopy":true,"highlightLang":true,"highlightHeightLimit":false},
  copy: {
    success: '复制成功',
    error: '复制错误',
    noSupport: '浏览器不支持'
  },
  relativeDate: {
    homepage: false,
    post: false
  },
  runtime: '',
  date_suffix: {
    just: '刚刚',
    min: '分钟前',
    hour: '小时前',
    day: '天前',
    month: '个月前'
  },
  copyright: undefined,
  lightbox: 'fancybox',
  Snackbar: undefined,
  source: {
    jQuery: 'https://cdn.jsdelivr.net/npm/jquery@latest/dist/jquery.min.js',
    justifiedGallery: {
      js: 'https://cdn.jsdelivr.net/npm/justifiedGallery/dist/js/jquery.justifiedGallery.min.js',
      css: 'https://cdn.jsdelivr.net/npm/justifiedGallery/dist/css/justifiedGallery.min.css'
    },
    fancybox: {
      js: 'https://cdn.jsdelivr.net/npm/@fancyapps/ui/dist/fancybox.umd.js',
      css: 'https://cdn.jsdelivr.net/npm/@fancyapps/ui/dist/fancybox.css'
    }
  },
  isPhotoFigcaption: false,
  islazyload: false,
  isanchor: false
}</script><script id="config-diff">var GLOBAL_CONFIG_SITE = {
  title: 'vuex',
  isPost: true,
  isHome: false,
  isHighlightShrink: false,
  isToc: true,
  postUpdate: '2021-09-01 10:26:37'
}</script><noscript><style type="text/css">
  #nav {
    opacity: 1
  }
  .justified-gallery img {
    opacity: 1
  }

  #recent-posts time,
  #post-meta time {
    display: inline !important
  }
</style></noscript><script>(win=>{
    win.saveToLocal = {
      set: function setWithExpiry(key, value, ttl) {
        if (ttl === 0) return
        const now = new Date()
        const expiryDay = ttl * 86400000
        const item = {
          value: value,
          expiry: now.getTime() + expiryDay,
        }
        localStorage.setItem(key, JSON.stringify(item))
      },

      get: function getWithExpiry(key) {
        const itemStr = localStorage.getItem(key)

        if (!itemStr) {
          return undefined
        }
        const item = JSON.parse(itemStr)
        const now = new Date()

        if (now.getTime() > item.expiry) {
          localStorage.removeItem(key)
          return undefined
        }
        return item.value
      }
    }
  
    win.getScript = url => new Promise((resolve, reject) => {
      const script = document.createElement('script')
      script.src = url
      script.async = true
      script.onerror = reject
      script.onload = script.onreadystatechange = function() {
        const loadState = this.readyState
        if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
        script.onload = script.onreadystatechange = null
        resolve()
      }
      document.head.appendChild(script)
    })
  
      win.activateDarkMode = function () {
        document.documentElement.setAttribute('data-theme', 'dark')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#0d0d0d')
        }
      }
      win.activateLightMode = function () {
        document.documentElement.setAttribute('data-theme', 'light')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#ffffff')
        }
      }
      const t = saveToLocal.get('theme')
    
          if (t === 'dark') activateDarkMode()
          else if (t === 'light') activateLightMode()
        
      const asideStatus = saveToLocal.get('aside-status')
      if (asideStatus !== undefined) {
        if (asideStatus === 'hide') {
          document.documentElement.classList.add('hide-aside')
        } else {
          document.documentElement.classList.remove('hide-aside')
        }
      }
    
    const detectApple = () => {
      if (GLOBAL_CONFIG_SITE.isHome && /iPad|iPhone|iPod|Macintosh/.test(navigator.userAgent)){
        document.documentElement.classList.add('apple')
      }
    }
    detectApple()
    })(window)</script><meta name="generator" content="Hexo 5.4.0"><link rel="alternate" href="/atom.xml" title="lhx个人博客" type="application/atom+xml">
</head><body><div id="loading-box"><div class="loading-left-bg"></div><div class="loading-right-bg"></div><div class="spinner-box"><div class="configure-border-1"><div class="configure-core"></div></div><div class="configure-border-2"><div class="configure-core"></div></div><div class="loading-word">加载中...</div></div></div><div id="sidebar"><div id="menu-mask"></div><div id="sidebar-menus"><div class="avatar-img is-center"><img src="https://img2.baidu.com/it/u=203845187,735199026&amp;fm=26&amp;fmt=auto&amp;gp=0.jpg" onerror="onerror=null;src='/img/friend_404.gif'" alt="avatar"/></div><div class="site-data is-center"><div class="data-item"><a href="/archives/"><div class="headline">文章</div><div class="length-num">31</div></a></div><div class="data-item"><a href="/tags/"><div class="headline">标签</div><div class="length-num">0</div></a></div><div class="data-item"><a href="/categories/"><div class="headline">分类</div><div class="length-num">10</div></a></div></div><hr/><div class="menus_items"><div class="menus_item"><a class="site-page" href="/archives/"><i class="fa-fw fas fa-archive"></i><span> 文章</span></a></div></div></div></div><div class="post" id="body-wrap"><header class="post-bg" id="page-header" style="background-image: url('https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/img/default.jpg')"><nav id="nav"><span id="blog_name"><a id="site-name" href="/">lhx个人博客</a></span><div id="menus"><div class="menus_items"><div class="menus_item"><a class="site-page" href="/archives/"><i class="fa-fw fas fa-archive"></i><span> 文章</span></a></div></div><div id="toggle-menu"><a class="site-page"><i class="fas fa-bars fa-fw"></i></a></div></div></nav><div id="post-info"><h1 class="post-title">vuex</h1><div id="post-meta"><div class="meta-firstline"><span class="post-meta-date"><i class="fa-fw post-meta-icon far fa-calendar-alt"></i><span class="post-meta-label">发表于</span><time datetime="2018-04-30T15:01:31.000Z" title="发表于 2018-04-30 23:01:31">2018-04-30</time></span><span class="post-meta-categories"><span class="post-meta-separator">|</span><i class="fas fa-inbox fa-fw post-meta-icon"></i><a class="post-meta-categories" href="/categories/Vue/">Vue</a></span></div><div class="meta-secondline"><span class="post-meta-separator">|</span><span class="post-meta-pv-cv" id="" data-flag-title="vuex"><i class="far fa-eye fa-fw post-meta-icon"></i><span class="post-meta-label">阅读量:</span><span id="busuanzi_value_page_pv"></span></span></div></div></div></header><main class="layout" id="content-inner"><div id="post"><article class="post-content" id="article-container"><h1 id="1-vuex是什么"><a href="#1-vuex是什么" class="headerlink" title="1. vuex是什么"></a>1. vuex是什么</h1><pre><code>一个vue插件库
作用: 对vue应用中组件的状态进行集中式的管理
</code></pre>
<h1 id="2-vuex的核心概念"><a href="#2-vuex的核心概念" class="headerlink" title="2. vuex的核心概念"></a>2. vuex的核心概念</h1><h2 id="1-state"><a href="#1-state" class="headerlink" title="1). state"></a>1). state</h2><pre><code>vuex管理的状态对象
它应该是唯一的
const state = &#123;
  xxx: initValue
&#125;
</code></pre>
<h2 id="2-mutations"><a href="#2-mutations" class="headerlink" title="2). mutations"></a>2). mutations</h2><pre><code>包含多个直接更新state的方法(回调函数)的对象
谁来触发: action中的commit(&#39;mutation名称&#39;)
只能包含同步的代码, 不能写异步代码
const mutations = &#123;
  yyy (state, &#123;data1&#125;) &#123;
    // 更新state的某个属性
  &#125;
&#125;
</code></pre>
<h2 id="3-actions"><a href="#3-actions" class="headerlink" title="3). actions"></a>3). actions</h2><pre><code>包含多个事件回调函数的对象
通过执行: commit()来触发mutation的调用, 间接更新state
谁来触发: 组件中: $store.dispatch(&#39;action名称&#39;, data1)  // &#39;zzz&#39;
可以包含异步代码(定时器, ajax)
const actions = &#123;
  zzz (&#123;commit, state&#125;, data1) &#123;
    commit(&#39;yyy&#39;, &#123;data1&#125;)
  &#125;
&#125;
</code></pre>
<h2 id="4-getters"><a href="#4-getters" class="headerlink" title="4). getters"></a>4). getters</h2><pre><code>包含多个计算属性(getter)的对象
谁来读取: 组件中: $store.getters.xxx
const getters = &#123;
  mmm (state) &#123;
    return ...
  &#125;
&#125;
</code></pre>
<h2 id="5-modules"><a href="#5-modules" class="headerlink" title="5). modules"></a>5). modules</h2><pre><code>包含多个module的对象
一个module是一个包含state/mutations/actions/getters的对象
是将一复杂应用的vuex代码进行多模块拆分的第2种方式
</code></pre>
<h2 id="6-store"><a href="#6-store" class="headerlink" title="6). store"></a>6). store</h2><pre><code>vuex的核心管理对象, 是组件与vuex通信的中间人
读取数据的属性
    state: 包含最新状态数据的对象
    getters: 包含getter计算属性的对象
更新数据的方法
    dispatch(): 分发调用action
    commit(): 提交调用mutation
</code></pre>
<h1 id="3-使用vuex"><a href="#3-使用vuex" class="headerlink" title="3. 使用vuex"></a>3. 使用vuex</h1><h2 id="1-创建并向外暴露store对象"><a href="#1-创建并向外暴露store对象" class="headerlink" title="1). 创建并向外暴露store对象"></a>1). 创建并向外暴露store对象</h2><pre><code>export default new Vuex.Store(&#123;
  state,
  mutations,
  actions,
  getters,
  modules: &#123;
    a,
    b
  &#125;
&#125;)
</code></pre>
<h2 id="2-注册store-main-js"><a href="#2-注册store-main-js" class="headerlink" title="2). 注册store: main.js"></a>2). 注册store: main.js</h2><pre><code>import store from &#39;./store&#39;
new Vue(&#123;
  store
&#125;)
</code></pre>
<h2 id="3-组件中通过store与vuex通信"><a href="#3-组件中通过store与vuex通信" class="headerlink" title="3). 组件中通过store与vuex通信"></a>3). 组件中通过store与vuex通信</h2><pre><code>import &#123;mapState, mapGetters&#125; from &#39;vuex&#39;
export default &#123;
  computed: (
    ...mapState([&#39;xxx&#39;]),
    ...mapGetters([&#39;yyy&#39;])
  )
  methods: &#123;
        test () &#123;
            this.$store.dispatch(&#39;zzz&#39;, data)
            this.$store.commit(&#39;zzz&#39;, data)
        &#125;
  &#125;
&#125;
</code></pre>
<h1 id="4-Vuex结构图"><a href="#4-Vuex结构图" class="headerlink" title="4. Vuex结构图"></a>4. Vuex结构图</h1><p><img src="https://user-gold-cdn.xitu.io/2020/2/20/1706235b7ef9bc52?w=1242&h=454&f=png&s=24446" alt="4. vuex结构图.png"></p>
</article><div class="post-copyright"><div class="post-copyright__author"><span class="post-copyright-meta">文章作者: </span><span class="post-copyright-info"><a href="mailto:undefined">李汉鑫</a></span></div><div class="post-copyright__type"><span class="post-copyright-meta">文章链接: </span><span class="post-copyright-info"><a href="http://example.com/Vue/vuex/">http://example.com/Vue/vuex/</a></span></div><div class="post-copyright__notice"><span class="post-copyright-meta">版权声明: </span><span class="post-copyright-info">本博客所有文章除特别声明外，均采用 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/" target="_blank">CC BY-NC-SA 4.0</a> 许可协议。转载请注明来自 <a href="http://example.com" target="_blank">lhx个人博客</a>！</span></div></div><div class="tag_share"><div class="post-meta__tag-list"></div><div class="post_share"><div class="social-share" data-image="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/img/default.jpg" data-sites="facebook,twitter,wechat,weibo,qq"></div><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/social-share.js/dist/css/share.min.css" media="print" onload="this.media='all'"><script src="https://cdn.jsdelivr.net/npm/social-share.js/dist/js/social-share.min.js" defer></script></div></div><nav class="pagination-post" id="pagination"><div class="prev-post pull-left"><a href="/Vue/%E6%BA%90%E7%A0%81%E5%88%86%E6%9E%90/"><img class="prev-cover" src="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/img/default.jpg" onerror="onerror=null;src='/img/404.jpg'" alt="cover of previous post"><div class="pagination-info"><div class="label">上一篇</div><div class="prev_info">源码分析</div></div></a></div><div class="next-post pull-right"><a href="/JavaScript/ES6/"><img class="next-cover" src="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/img/default.jpg" onerror="onerror=null;src='/img/404.jpg'" alt="cover of next post"><div class="pagination-info"><div class="label">下一篇</div><div class="next_info">ES6</div></div></a></div></nav></div><div class="aside-content" id="aside-content"><div class="card-widget card-info"><div class="is-center"><div class="avatar-img"><img src="https://img2.baidu.com/it/u=203845187,735199026&amp;fm=26&amp;fmt=auto&amp;gp=0.jpg" onerror="this.onerror=null;this.src='/img/friend_404.gif'" alt="avatar"/></div><div class="author-info__name">李汉鑫</div><div class="author-info__description">前端基础CSS、Js、Vue、React、移动端、小程序、网络</div></div><div class="card-info-data is-center"><div class="card-info-data-item"><a href="/archives/"><div class="headline">文章</div><div class="length-num">31</div></a></div><div class="card-info-data-item"><a href="/tags/"><div class="headline">标签</div><div class="length-num">0</div></a></div><div class="card-info-data-item"><a href="/categories/"><div class="headline">分类</div><div class="length-num">10</div></a></div></div></div><div class="card-widget card-announcement"><div class="item-headline"><i class="fas fa-bullhorn card-announcement-animation"></i><span>公告</span></div><div class="announcement_content">个人网站,欢迎交流</div></div><div class="sticky_layout"><div class="card-widget" id="card-toc"><div class="item-headline"><i class="fas fa-stream"></i><span>目录</span></div><div class="toc-content"><ol class="toc"><li class="toc-item toc-level-1"><a class="toc-link" href="#1-vuex%E6%98%AF%E4%BB%80%E4%B9%88"><span class="toc-number">1.</span> <span class="toc-text">1. vuex是什么</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#2-vuex%E7%9A%84%E6%A0%B8%E5%BF%83%E6%A6%82%E5%BF%B5"><span class="toc-number">2.</span> <span class="toc-text">2. vuex的核心概念</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#1-state"><span class="toc-number">2.1.</span> <span class="toc-text">1). state</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#2-mutations"><span class="toc-number">2.2.</span> <span class="toc-text">2). mutations</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#3-actions"><span class="toc-number">2.3.</span> <span class="toc-text">3). actions</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#4-getters"><span class="toc-number">2.4.</span> <span class="toc-text">4). getters</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#5-modules"><span class="toc-number">2.5.</span> <span class="toc-text">5). modules</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#6-store"><span class="toc-number">2.6.</span> <span class="toc-text">6). store</span></a></li></ol></li><li class="toc-item toc-level-1"><a class="toc-link" href="#3-%E4%BD%BF%E7%94%A8vuex"><span class="toc-number">3.</span> <span class="toc-text">3. 使用vuex</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#1-%E5%88%9B%E5%BB%BA%E5%B9%B6%E5%90%91%E5%A4%96%E6%9A%B4%E9%9C%B2store%E5%AF%B9%E8%B1%A1"><span class="toc-number">3.1.</span> <span class="toc-text">1). 创建并向外暴露store对象</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#2-%E6%B3%A8%E5%86%8Cstore-main-js"><span class="toc-number">3.2.</span> <span class="toc-text">2). 注册store: main.js</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#3-%E7%BB%84%E4%BB%B6%E4%B8%AD%E9%80%9A%E8%BF%87store%E4%B8%8Evuex%E9%80%9A%E4%BF%A1"><span class="toc-number">3.3.</span> <span class="toc-text">3). 组件中通过store与vuex通信</span></a></li></ol></li><li class="toc-item toc-level-1"><a class="toc-link" href="#4-Vuex%E7%BB%93%E6%9E%84%E5%9B%BE"><span class="toc-number">4.</span> <span class="toc-text">4. Vuex结构图</span></a></li></ol></div></div><div class="card-widget card-recent-post"><div class="item-headline"><i class="fas fa-history"></i><span>最新文章</span></div><div class="aside-list"><div class="aside-list-item"><a class="thumbnail" href="/%E7%A7%BB%E5%8A%A8%E7%AB%AF/%E7%A7%BB%E5%8A%A8%E7%AB%AF/" title="移动端"><img src="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/img/default.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="移动端"/></a><div class="content"><a class="title" href="/%E7%A7%BB%E5%8A%A8%E7%AB%AF/%E7%A7%BB%E5%8A%A8%E7%AB%AF/" title="移动端">移动端</a><time datetime="2021-06-07T09:21:39.000Z" title="发表于 2021-06-07 17:21:39">2021-06-07</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/%E5%B0%8F%E7%A8%8B%E5%BA%8F/%E5%B0%8F%E7%A8%8B%E5%BA%8F/" title="小程序基础"><img src="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/img/default.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="小程序基础"/></a><div class="content"><a class="title" href="/%E5%B0%8F%E7%A8%8B%E5%BA%8F/%E5%B0%8F%E7%A8%8B%E5%BA%8F/" title="小程序基础">小程序基础</a><time datetime="2021-05-03T05:20:10.000Z" title="发表于 2021-05-03 13:20:10">2021-05-03</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/%E7%BD%91%E7%BB%9C/http%E5%8D%8F%E8%AE%AE%E4%B8%89%E6%AC%A1%E6%8F%A1%E6%89%8B%E5%92%8C%E5%9B%9B%E6%AC%A1%E6%8C%A5%E6%89%8B/" title="http协议三次握手和四次挥手"><img src="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/img/default.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="http协议三次握手和四次挥手"/></a><div class="content"><a class="title" href="/%E7%BD%91%E7%BB%9C/http%E5%8D%8F%E8%AE%AE%E4%B8%89%E6%AC%A1%E6%8F%A1%E6%89%8B%E5%92%8C%E5%9B%9B%E6%AC%A1%E6%8C%A5%E6%89%8B/" title="http协议三次握手和四次挥手">http协议三次握手和四次挥手</a><time datetime="2020-10-25T13:40:49.000Z" title="发表于 2020-10-25 21:40:49">2020-10-25</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/%E7%BD%91%E7%BB%9C/%E5%9C%A8%E6%B5%8F%E8%A7%88%E5%99%A8%E5%9C%B0%E5%9D%80%E6%A0%8F%E8%BE%93%E5%85%A5url%E7%84%B6%E5%90%8E%E6%95%B2%E5%87%BB%E5%9B%9E%E8%BD%A6%E4%B9%8B%E5%90%8E%E9%83%BD%E5%81%9A%E4%BA%86%E4%BB%80%E4%B9%88/" title="在浏览器地址栏输入url然后敲击回车之后都做了什么"><img src="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/img/default.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="在浏览器地址栏输入url然后敲击回车之后都做了什么"/></a><div class="content"><a class="title" href="/%E7%BD%91%E7%BB%9C/%E5%9C%A8%E6%B5%8F%E8%A7%88%E5%99%A8%E5%9C%B0%E5%9D%80%E6%A0%8F%E8%BE%93%E5%85%A5url%E7%84%B6%E5%90%8E%E6%95%B2%E5%87%BB%E5%9B%9E%E8%BD%A6%E4%B9%8B%E5%90%8E%E9%83%BD%E5%81%9A%E4%BA%86%E4%BB%80%E4%B9%88/" title="在浏览器地址栏输入url然后敲击回车之后都做了什么">在浏览器地址栏输入url然后敲击回车之后都做了什么</a><time datetime="2020-10-24T14:10:19.000Z" title="发表于 2020-10-24 22:10:19">2020-10-24</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/%E7%BD%91%E7%BB%9C/%E8%AF%B7%E6%B1%82%E5%93%8D%E5%BA%94%E6%8A%A5%E6%96%87/" title="请求响应报文"><img src="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/img/default.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="请求响应报文"/></a><div class="content"><a class="title" href="/%E7%BD%91%E7%BB%9C/%E8%AF%B7%E6%B1%82%E5%93%8D%E5%BA%94%E6%8A%A5%E6%96%87/" title="请求响应报文">请求响应报文</a><time datetime="2020-10-24T12:21:39.000Z" title="发表于 2020-10-24 20:21:39">2020-10-24</time></div></div></div></div></div></div></main><footer id="footer"><div id="footer-wrap"><div class="copyright">&copy;2020 - 2021 By 李汉鑫</div><div class="framework-info"><span>框架 </span><a target="_blank" rel="noopener" href="https://hexo.io">Hexo</a><span class="footer-separator">|</span><span>主题 </span><a target="_blank" rel="noopener" href="https://github.com/jerryc127/hexo-theme-butterfly">Butterfly</a></div></div></footer></div><div id="rightside"><div id="rightside-config-hide"><button id="readmode" type="button" title="阅读模式"><i class="fas fa-book-open"></i></button><button id="darkmode" type="button" title="浅色和深色模式转换"><i class="fas fa-adjust"></i></button><button id="hide-aside-btn" type="button" title="单栏和双栏切换"><i class="fas fa-arrows-alt-h"></i></button></div><div id="rightside-config-show"><button id="rightside_config" type="button" title="设置"><i class="fas fa-cog fa-spin"></i></button><button class="close" id="mobile-toc-button" type="button" title="目录"><i class="fas fa-list-ul"></i></button><button id="go-up" type="button" title="回到顶部"><i class="fas fa-arrow-up"></i></button></div></div><div><script src="/js/utils.js"></script><script src="/js/main.js"></script><script>var preloader = {
  endLoading: () => {
    document.body.style.overflow = 'auto';
    document.getElementById('loading-box').classList.add("loaded")
  },
  initLoading: () => {
    document.body.style.overflow = '';
    document.getElementById('loading-box').classList.remove("loaded")

  }
}
window.addEventListener('load',preloader.endLoading())</script><div class="js-pjax"></div><script async data-pjax src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script></div></body></html>